package com.xiaoxing.zhinenghuacangku_liaocheng.mvp.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.xiaoxing.zhinenghuacangku_liaocheng.R;
import com.xiaoxing.zhinenghuacangku_liaocheng.R2;
import com.xiaoxing.zhinenghuacangku_liaocheng.di.component.DaggerLiaoCheng_TuiKuXuanZeComponent;
import com.xiaoxing.zhinenghuacangku_liaocheng.di.module.LiaoCheng_TuiKuXuanZeModule;
import com.xiaoxing.zhinenghuacangku_liaocheng.mvp.contract.LiaoCheng_TuiKuXuanZeContract;
import com.xiaoxing.zhinenghuacangku_liaocheng.mvp.presenter.LiaoCheng_TuiKuXuanZePresenter;
import com.xiaoxing.zhinenghuacangku_liaocheng.mvp.ui.entity.LiaoCheng_TuiKuXuanZe;

import java.util.HashMap;

import butterknife.OnClick;
import com.jess.arms.utils.CProgressDialogUtils;
import me.jessyan.armscomponent.commonres.utils.ToolbarUtils;
import me.jessyan.armscomponent.commonsdk.core.RouterHub;
import me.jessyan.armscomponent.commonsdk.utils.Utils;

import static com.jess.arms.utils.Preconditions.checkNotNull;


@Route(path = RouterHub.ZHI_NENG_HUA_CANG_KU_LIAO_CHENG_ACTIVITY_LIAO_CHENG_TUI_KU_XUAN_ZE)
public class LiaoCheng_TuiKuXuanZeActivity extends BaseActivity<LiaoCheng_TuiKuXuanZePresenter> implements LiaoCheng_TuiKuXuanZeContract.View {


    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerLiaoCheng_TuiKuXuanZeComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .liaoCheng_TuiKuXuanZeModule(new LiaoCheng_TuiKuXuanZeModule(this))
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_liao_cheng__tui_ku_xuan_ze; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {

        ToolbarUtils.initToolbarTitleBack(this, getString(R.string.activity_liao_cheng__tui_ku_xuan_ze));
        //getLiaoCheng_TuiKuXuanZeData();
    }

    @Override
    public void getLiaoCheng_TuiKuXuanZeDataSuccess(LiaoCheng_TuiKuXuanZe entityData) {


    }

    private void getLiaoCheng_TuiKuXuanZeData() {
        HashMap<String, String> map = new HashMap<>();

        mPresenter.getLiaoCheng_TuiKuXuanZeData(map);
    }


    @Override
    public void showLoading() {
        CProgressDialogUtils.showProgressDialog(this);
    }

    @Override
    public void hideLoading() {
        CProgressDialogUtils.cancelProgressDialog(this);
    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.makeText(this, message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }


    @OnClick({R2.id.btn_sao_ma_tui_ku, R2.id.btn_chu_ku_dan_xuan_ze_tui_ku, R2.id.btn_tui_ku_fan_hui_lie_biao})
    public void onViewClicked(View view) {
        int id = view.getId();
        if (id == R.id.btn_sao_ma_tui_ku) {
            Bundle bundle = new Bundle();
            bundle.putString("type", "0");
            bundle.putString("mid", "");
            Utils.navigation(getContext(), RouterHub.ZHI_NENG_HUA_CANG_KU_LIAO_CHENG_ACTIVITY_LIAO_CHENG_SAO_MA_TUI_KU, bundle);
        } else if (id == R.id.btn_chu_ku_dan_xuan_ze_tui_ku) {
            Utils.navigation(getContext(), RouterHub.ZHI_NENG_HUA_CANG_KU_LIAO_CHENG_ACTIVITY_LIAO_CHENG_TUI_KU_CHU_KU_DAN);
        } else if (id == R.id.btn_tui_ku_fan_hui_lie_biao) {
            Utils.navigation(getContext(), RouterHub.ZHI_NENG_HUA_CANG_KU_LIAO_CHENG_ACTIVITY_LIAO_CHENG_TUI_KU_FAN_HUI_LIE_BIAO);
        }
    }
}
